#ifndef __ming_fyp_Camera_h__
#define __ming_fyp_Camera_h__

//------------------------------------------------------------------------------
// header includes
#include "fyp/core/Vec.h"
#include "fyp/core/Matrix.h"

//------------------------------------------------------------------------------
namespace ming
{
namespace fyp
{
	//--------------------------------------------------------------------------
	class TCamera
	{
	public:
		//------------------------------
		// #cstor & #dstor
		TCamera();
		~TCamera();
		
		//------------------------------
		// external operations
		void SetViewParams(float fov, float aspect, float zNear, float zFar);
		void SetTargetPosition(const TVec3 &pos, float distance);
		
		void Yaw(float angle);
		void Pitch(float angle);
		void Forward(float dist);

		TMtx44 GetViewMatrix();
		TMtx44 GetProjMatrix();

		TVec3 GetViewPosition();
		TVec3 GetViewDirection();
		TVec4 GetViewNearPlane();
		TVec4 GetViewNearPlaneNormalized();
		
	private:
		//------------------------------
		// internal attributes
		TVec3 mTargetPos;
		float mTargetDist;
		float mYaw;
		float mPitch;
		float mFov;
		float mAspect;
		float mZNear;
		float mZFar;

		TVec3 mViewPos;
		TVec3 mViewDir;
		TMtx44 mViewMtx;
		bool mViewParamDirty;

		TMtx44 mProjMtx;
		bool mProjParamDirty;

		//------------------------------
		// internal operations
		void UpdateViewMtx();
		void UpdateProjMtx();

		void MarkViewParamDirty();
		void MarkProjParamDirty();
	};
	
	//--------------------------------------------------------------------------
}
}


#endif	//__ming_fyp_Camera_h__